import React,{useState,useEffect} from 'react'
import Input from './Input'
import List from './List'



export const Todolist = () => {
    const [list, setList] = useState(JSON.parse(localStorage.getItem('todolist')) || []);
    const addItem = (val)=>{
        setList([val,...list]);
    }
    useEffect(()=>{
        localStorage.setItem('todolist',JSON.stringify(list));
    },[list])
    return (
        <div>
            <Input />
            <List/>        
            
        </div>
    )
}

